package top.yzhao.trackdatasystem.utils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * User: zhaoyang
 * Date: 2020/3/13
 * Time: 14:16
 * Description: No Description
 */
public class IpUtilsMy {

    /**
     * 获取请求Ip
     * @return
     */
    public static String getRemoteRequestIp(){
        HttpServletRequest req = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        String remoteAddr = req.getRemoteAddr();
        return remoteAddr;
    }
}
